package com.netbao.sys.controller;

import com.netbao.model.PageBean;
import com.netbao.model.PageResult;
import com.netbao.model.Result;
import com.netbao.sys.model.Enterprise;
import com.netbao.sys.service.EnterpriseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/sys/ent")
public class EnterpriseController {
    @Autowired
    private EnterpriseService enterpriseService;

    @GetMapping("/list")
    public PageResult list(PageBean pageBean, String cName){
        return enterpriseService.list(pageBean,cName);
    }

    @PostMapping("/save")
    public Result save(Enterprise enterprise){
        System.out.println(enterprise);
        return enterpriseService.save(enterprise);
    }

    @PostMapping("/delete")
    public Result delete(Long eid){
//        System.out.println(".................."+eid);
        return enterpriseService.delete(eid);
    }

}
